<!-- Faraday Penetration Test IDE -->
<!-- Copyright (C) 2013  Infobyte LLC (http://www.infobytesec.com/) -->
<!-- See the file 'doc/LICENSE' for the license information -->

<form novalidate>
    <div class="faraday-header-border-fix"></div>
    <section id="main" class="seccion clearfix">
        <div class="right-main">

            <div ng-controller="headerCtrl" ng-include="'scripts/commons/partials/header.html'"></div>
            <div id="reports-main" class="fila clearfix">

            <div class="reports col-md-12 col-sm-12 col-xs-12">
                <div class="button-control justify-flex-start  col-md-12 col-sm-12 col-xs-12">
                    <div class="control-wrapper control-new">
                        <button id="merge" type="button" class="btn btn-success btn-new" title="New Workspace" ng-click="new()">
                            New
                        </button>
                    </div>
                    <div class="control-wrapper control-edit">
                        <button type="button" class="btn btn-default edit" title="Edit selected Workspaces" ng-click="edit()">
                            <img src="images/icon-toolbar-edit.svg" class="edit-icon" />
                        </button>
                    </div>
                    <div class="control-wrapper">
                        <button  id="delete" type="button" class="btn btn-default" title="Delete selected Workspaces" ng-click="delete()">
                            <img src="images/icon-toolbar-delete.svg" class="delete-icon" />
                        </button>
                    </div>
                    <div class="control-wrapper search-wrapper">
                        <form role="form">
                            <div class="form-group">
                                <div class="input-group">
                                    <span class="input-group-addon glyphicon-btn glyphicon glyphicon-remove" ng-if="search && search != 'confirmed=true'" ng-click="clearSearch()"></span>
                                    <input type="text" class="form-control" placeholder="Enter keywords" ng-model="search" />
                                    <span class="input-group-addon glyphicon-btn">
                                        <img src="images/icon-toolbar-searchbar-loupe.svg" class="search-icon" />
                                    </span>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <table class="table-v3 table table-responsive">
                    <thead>
                        <tr class="ui-grid-header">
                            <th class="ui-grid-cell-contents ui-grid-header-cell">Read only</th>
                            <th class="ui-grid-cell-contents ui-grid-header-cell">Active</th>
                            <th class="ui-grid-cell-contents ui-grid-header-cell">
                                <a href="" ng-click="toggleSort('name')">Name</a>
                            </th>
                            <th class="ui-grid-cell-contents ui-grid-header-cell">Start Date</th>
                            <th class="ui-grid-cell-contents ui-grid-header-cell">End Date</th>
                            <th class="ui-grid-cell-contents ui-grid-header-cell">Vulns</th>
                            <th class="ui-grid-cell-contents ui-grid-header-cell">Hosts</th>
                            <th class="ui-grid-cell-contents ui-grid-header-cell">Services</th>
                            <th class="ui-grid-cell-contents ui-grid-header-cell">Last Modified</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-repeat="ws in workspaces | filter:query | filter:search | orderBy:sortField:reverse"
                            selection-model selection-model-selected-class="multi-selected">

                            <td class="ui-grid-cell-contents active-toggle">
                                <div class="toogle-img-container">
                                    <span ng-click="readonlyToggle(ws)" class="active-toggle-container" ng-class="{ disabled:ws.readonly === false }" uib-tooltip="{{(ws.readonly === false) ? 'Workspace with all permissions' : 'Workspace read only'}}" tooltip-placement="right">
                                        <img ng-src="{{ (ws.readonly == true) ? 'images/icon-list-confirmed.svg' : 'images/icon-list-notconfirmed.svg'}}" class="confirm-icon" ng-style="{ 'opacity': (ws.readonly === true) ? '1' : '0.7' }" />
                                    </span>
                                </div>
                            </td>

                            <td class="ui-grid-cell-contents active-toggle">
                                <div class="toogle-img-container">
                                    <span ng-click="activeToggle(ws)" class="active-toggle-container" ng-class="{ disabled:ws.active === false }" uib-tooltip="{{(ws.active === true) ? 'Disable workspace' : 'Enable workspace'}}" tooltip-placement="right">
                                        <img ng-src="{{ (ws.active) ? 'images/icon-list-confirmed.svg' : 'images/icon-list-notconfirmed.svg'}}" class="confirm-icon" ng-style="{ 'opacity': (ws.active === true) ? '1' : '0.7' }" />
                                    </span>
                                </div>
                            </td>
                            <td class="ui-grid-cell-contents">
                                <span class="onhover upsize" ng-click="dashboardRedirect(ws.name)">
                                   <b>{{ws.name}}</b>
                                </span>
                            </td>
                            <td class="ui-grid-cell-contents" ng-bind="ws.duration.start_date | amUtc | amDateFormat:'MM/DD/YYYY'"></td>
                            <td class="ui-grid-cell-contents" ng-bind="ws.duration.end_date | amUtc | amDateFormat:'MM/DD/YYYY'"></td>
                            <td class="ui-grid-cell-contents"><a href="#/status/ws/{{ws.name}}">{{objects[ws.name]['total_vulns']}}</a></td>
                            <td class="ui-grid-cell-contents"><a href="#/hosts/ws/{{ws.name}}">{{objects[ws.name]['hosts']}}</a></td>
                            <td class="ui-grid-cell-contents" ng-bind="objects[ws.name]['services']"></td>
                            <td class="ui-grid-cell-contents" ng-bind="ws.last_modified | amUtc | amDateFormat:'MM/DD/YYYY'"></td>
                        </tr>
                    </tbody>
                </table><!-- #hosts -->
            </div><!-- .reports -->
        </div><!-- #reports-main --></div><!-- .right-main -->
    </section><!-- #main -->
</form>
